class Solution {
public:
    string removeDuplicates(string s) {
        // 数组模拟栈实现
        string ret;
        for (auto c : s)
        {
            if (ret.size() && c == ret.back())
                ret.pop_back();
            else
                ret += c;
        }
        return ret;
    }
};